package com.ly.web.controller.erp;

import com.ly.common.annotation.Log;
import com.ly.common.core.domain.AjaxResult;
import com.ly.heart.domain.KingOrgEntity;
import com.ly.heart.service.IKingOrgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 绑定ERP组织和金蝶账套 前端控制器
 * </p>
 * @author WuZH
 * @since 2024-09-25
 */
@Api (value = "kingOrg", tags = "ERP与金蝶绑定")
@RestController
@RequestMapping ("/heart/kingOrg")
public class KingOrgController {


    @Resource
    private IKingOrgService iKingOrgService;

    @GetMapping ("list")
    @ApiOperation ("ERP与金蝶绑定列表")
    @Log (title = "ERP与金蝶绑定列表")
    public AjaxResult list (KingOrgEntity kingOrgEntity) {
        return iKingOrgService.queryList ( kingOrgEntity );
    }

    @PostMapping
    @ApiOperation ("ERP与金蝶绑定新增")
    @Log (title = "ERP与金蝶绑定新增")
    public AjaxResult saveSingle (@RequestBody KingOrgEntity kingOrgEntity) {
        return iKingOrgService.saveSingle ( kingOrgEntity );
    }

    @GetMapping ("/{id}")
    @ApiOperation ("ERP与金蝶绑定详情")
    @Log (title = "ERP与金蝶绑定详情")
    public AjaxResult querySingle (@PathVariable String id) {
        KingOrgEntity orgEntity = iKingOrgService.querySingle ( id );
        return AjaxResult.success ( orgEntity );
    }

    @PutMapping
    @ApiOperation ("ERP与金蝶绑定修改")
    @Log (title = "ERP与金蝶绑定修改")
    public AjaxResult updateSingle (@RequestBody KingOrgEntity kingOrgEntity) {
        return iKingOrgService.updateSingle ( kingOrgEntity );
    }

    @DeleteMapping ("/{id}")
    @ApiOperation ("ERP与金蝶绑定删除")
    @Log (title = "ERP与金蝶绑定删除")
    public AjaxResult deleteSingle (@PathVariable String id) {
        AjaxResult ajaxResult = iKingOrgService.deleteSingle ( id );
        return ajaxResult;
    }

    @RequestMapping ("disabled")
    @ApiOperation ("ERP与金蝶绑定禁用")
    @Log (title = "ERP与金蝶绑定禁用")
    public AjaxResult disabled (String id) {
        AjaxResult ajaxResult = iKingOrgService.disabled ( id );
        return ajaxResult;
    }


}
